﻿using B.S.AuthCenter.Api.Read.Application.Command.Department;
using B.S.AuthCenter.Api.Read.DTOs;
using B.S.AuthCenter.Domain;
using B.S.AuthCenter.ErrorCount;
using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.AuthCenter.Api.Read.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [Authorize]
    public class DepartmentsController : ControllerBase
    {
        IMediator mediator;

        public DepartmentsController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        [HttpGet]
        public Task<ApiResult<List<UsersTreeDTO>>> GetDepartment([FromQuery]GetDepartmentCommand request)
        {
            return mediator.Send(request);
        }
    }
}
